package day_01;

import java.io.*;

public class File_copy {
    public static void main(String[] args) throws IOException {
        String path = "./Test/copy.txt";
        File file = new File("./Test/1.txt");
        copyFile(file,path);

    }

    public static void copyFile(File file,String path) throws IOException {
        FileInputStream fis = new FileInputStream(file);
        FileOutputStream fos = new FileOutputStream(new File(path));

        byte[] bytes = new byte[1024];
        int len = -1;
        while((len=fis.read(bytes)) != -1){
            fos.write(bytes,0,len);
        }
        fis.close();
        fos.close();
    }

}
